import i18n from './common/i18n/index.js'

// #ifdef MP-WEIXIN
let BASE_URL = '', SIGN = ''
const extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {}
if(Object.keys(extConfig).length === 0) {
	uni.showModal({
		title: i18n.t('common.network.extMissing')
	})
} else {
	if(!extConfig.domain) {
		uni.showModal({
			title: i18n.t('common.network.domainInvalid')
		})
	}
	// if(!extConfig.sign) {
	// 	uni.showModal({
	// 		title: '网站标识有误，请联系管理员'
	// 	})
	// }
	BASE_URL = 'https://' + extConfig.domain
	SIGN = extConfig.sign
}
// #endif

// #ifdef H5
let BASE_URL = '', SIGN = ''
if (process.env.NODE_ENV === 'development') {
	BASE_URL = 'http://localhost'
	SIGN = ''
} else {
	BASE_URL = window.location.origin
	//BASE_URL = 'http://api.xingzhics.com'
	SIGN = window.location.search.replace(/\?/g, "")
}
// #endif

// #ifdef APP-PLUS
let BASE_URL = 'http://api.xingzhics.com',
	SIGN = ''
// #endif


export {
	BASE_URL,
	SIGN
}